home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / OCE.p < prev    next >
Encoding:
Text File  |  1996-01-15  |  47.6 KB  |  1,335 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        OCE.p
  3.  
  4.      Contains:    Apple Open Collaboration Environment (AOCE) Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Package:    Universal Interfaces 2.1.2 on ETO #20
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT OCE;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __OCE__}
  30. {$SETC __OCE__ := 1}
  31.  
  32. {$I+}
  33. {$SETC OCEIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __ALIASES__}
  38. {$I Aliases.p}
  39. {$ENDC}
  40. {    Types.p                                                        }
  41. {        ConditionalMacros.p                                        }
  42. {    AppleTalk.p                                                    }
  43. {        OSUtils.p                                                }
  44. {            MixedMode.p                                            }
  45. {            Memory.p                                            }
  46. {    Files.p                                                        }
  47. {        Finder.p                                                }
  48.  
  49. {$IFC UNDEFINED __APPLEEVENTS__}
  50. {$I AppleEvents.p}
  51. {$ENDC}
  52. {    Errors.p                                                    }
  53. {    Events.p                                                    }
  54. {        Quickdraw.p                                                }
  55. {            QuickdrawText.p                                        }
  56. {    EPPC.p                                                        }
  57. {        PPCToolbox.p                                            }
  58. {        Processes.p                                                }
  59. {    Notification.p                                                }
  60.  
  61. {$IFC UNDEFINED __SCRIPT__}
  62. {$I Script.p}
  63. {$ENDC}
  64. {    IntlResources.p                                                }
  65.  
  66. {$IFC UNDEFINED __TYPES__}
  67. {$I Types.p}
  68. {$ENDC}
  69.  
  70. {$PUSH}
  71. {$ALIGN MAC68K}
  72. {$LibExport+}
  73. { All utility routines defined here are callable at interrupt level. }
  74.     
  75. TYPE
  76.     OCERecordTypeIndex = INTEGER;
  77.  
  78.     OCEAttributeTypeIndex = INTEGER;
  79.  
  80. { For anyone who absolutely needs a define of the body of the standard record or
  81. attribute type, use these below.  CAUTION!  All the types below are assumed to be
  82. in character set 'smRoman'.  If you try to compare these to some RString or
  83. AttributeType variable, you must take the character set code into account.  Future
  84. standard types may be defined using character sets other than 'smRoman'. }
  85. { All these standard definitions begin with the Apple symbol (not shown here).
  86.  
  87. NOTE:  To access these, you must call OCEGetIndRecordType or OCEGetIndAttributeType
  88. with the proper index.  These routines return pointers to the standard type.
  89. This was done so that code fragments (INITs, CDEVs, CSAMs, etc). which cannot
  90. use global data can also use these. }
  91. { Indices for the standard definitions for certain record types (OCERecordTypeIndex): }
  92.  
  93. CONST
  94.     kUserRecTypeNum                = 1;                            { "User" }
  95.     kGroupRecTypeNum            = 2;                            { "Group" }
  96.     kMnMRecTypeNum                = 3;                            { "AppleMail™ M&M" }
  97.     kMnMForwarderRecTypeNum        = 4;                            { "AppleMail™ Fwdr" }
  98.     kNetworkSpecRecTypeNum        = 5;                            { "NetworkSpec" }
  99.     kADAPServerRecTypeNum        = 6;                            { "ADAP Server" }
  100.     kADAPDNodeRecTypeNum        = 7;                            { "ADAP DNode" }
  101.     kADAPDNodeRepRecTypeNum        = 8;                            { "ADAP DNode Rep" }
  102.     kServerSetupRecTypeNum        = 9;                            { "Server Setup" }
  103.     kDirectoryRecTypeNum        = 10;                            { "Directory" }
  104.     kDNodeRecTypeNum            = 11;                            { "DNode" }
  105.     kSetupRecTypeNum            = 12;                            { "Setup" }
  106.     kMSAMRecTypeNum                = 13;                            { "MSAM" }
  107.     kDSAMRecTypeNum                = 14;                            { "DSAM" }
  108.     kAttributeValueRecTypeNum    = 15;                            { "Attribute Value" }
  109.     kBusinessCardRecTypeNum        = 16;                            { "Business Card" }
  110.     kMailServiceRecTypeNum        = 17;                            { "Mail Service" }
  111.     kCombinedRecTypeNum            = 18;                            { "Combined" }
  112.     kOtherServiceRecTypeNum        = 19;                            { "Other Service" }
  113.     kAFPServiceRecTypeNum        = 20;                            { "Other Service afps" }
  114.     kFirstOCERecTypeNum            = kUserRecTypeNum;                { first standard OCE record type }
  115.     kLastOCERecTypeNum            = kAFPServiceRecTypeNum;        { last standard OCE record type }
  116.     kNumOCERecTypes                = 0+(kLastOCERecTypeNum - kFirstOCERecTypeNum + 1);
  117.  
  118. { Indices for the standard definitions for certain attribute types (OCEAttributeTypeIndex): }
  119.     kMemberAttrTypeNum            = 1001;                            { "Member" }
  120.     kAdminsAttrTypeNum            = 1002;                            { "Administrators" }
  121.     kMailSlotsAttrTypeNum        = 1003;                            { "mailslots" }
  122.     kPrefMailAttrTypeNum        = 1004;                            { "pref mailslot" }
  123.     kAddressAttrTypeNum            = 1005;                            { "Address" }
  124.     kPictureAttrTypeNum            = 1006;                            { "Picture" }
  125.     kAuthKeyAttrTypeNum            = 1007;                            { "auth key" }
  126.     kTelephoneAttrTypeNum        = 1008;                            { "Telephone" }
  127.     kNBPNameAttrTypeNum            = 1009;                            { "NBP Name" }
  128.     kQMappingAttrTypeNum        = 1010;                            { "ForwarderQMap" }
  129.     kDialupSlotAttrTypeNum        = 1011;                            { "DialupSlotInfo" }
  130.     kHomeNetAttrTypeNum            = 1012;                            { "Home Internet" }
  131.     kCoResAttrTypeNum            = 1013;                            { "Co-resident M&M" }
  132.     kFwdrLocalAttrTypeNum        = 1014;                            { "FwdrLocalRecord" }
  133.     kConnectAttrTypeNum            = 1015;                            { "Connected To" }
  134.     kForeignAttrTypeNum            = 1016;                            { "Foreign RLIs" }
  135.     kOwnersAttrTypeNum            = 1017;                            { "Owners" }
  136.     kReadListAttrTypeNum        = 1018;                            { "ReadList" }
  137.     kWriteListAttrTypeNum        = 1019;                            { "WriteList" }
  138.     kDescriptorAttrTypeNum        = 1020;                            { "Descriptor" }
  139.     kCertificateAttrTypeNum        = 1021;                            { "Certificate" }
  140.     kMsgQsAttrTypeNum            = 1022;                            { "MessageQs" }
  141.     kPrefMsgQAttrTypeNum        = 1023;                            { "PrefMessageQ" }
  142.     kMasterPFAttrTypeNum        = 1024;                            { "MasterPF" }
  143.     kMasterNetSpecAttrTypeNum    = 1025;                            { "MasterNetSpec" }
  144.     kServersOfAttrTypeNum        = 1026;                            { "Servers Of" }
  145.     kParentCIDAttrTypeNum        = 1027;                            { "Parent CID" }
  146.     kNetworkSpecAttrTypeNum        = 1028;                            { "NetworkSpec" }
  147.     kLocationAttrTypeNum        = 1029;                            { "Location" }
  148.     kTimeSvrTypeAttrTypeNum        = 1030;                            { "TimeServer Type" }
  149.     kUpdateTimerAttrTypeNum        = 1031;                            { "Update Timer" }
  150.     kShadowsOfAttrTypeNum        = 1032;                            { "Shadows Of" }
  151.     kShadowServerAttrTypeNum    = 1033;                            { "Shadow Server" }
  152.     kTBSetupAttrTypeNum            = 1034;                            { "TB Setup" }
  153.     kMailSetupAttrTypeNum        = 1035;                            { "Mail Setup" }
  154.     kSlotIDAttrTypeNum            = 1036;                            { "SlotID" }
  155.     kGatewayFileIDAttrTypeNum    = 1037;                            { "Gateway FileID" }
  156.     kMailServiceAttrTypeNum        = 1038;                            { "Mail Service" }
  157.     kStdSlotInfoAttrTypeNum        = 1039;                            { "Std Slot Info" }
  158.     kAssoDirectoryAttrTypeNum    = 1040;                            { "Asso. Directory" }
  159.     kDirectoryAttrTypeNum        = 1041;                            { "Directory" }
  160.     kDirectoriesAttrTypeNum        = 1042;                            { "Directories" }
  161.     kSFlagsAttrTypeNum            = 1043;                            { "SFlags" }
  162.     kLocalNameAttrTypeNum        = 1044;                            { "Local Name" }
  163.     kLocalKeyAttrTypeNum        = 1045;                            { "Local Key" }
  164.     kDirUserRIDAttrTypeNum        = 1046;                            { "Dir User RID" }
  165.     kDirUserKeyAttrTypeNum        = 1047;                            { "Dir User Key" }
  166.     kDirNativeNameAttrTypeNum    = 1048;                            { "Dir Native Name" }
  167.     kCommentAttrTypeNum            = 1049;                            { "Comment" }
  168.     kRealNameAttrTypeNum        = 1050;                            { "Real Name" }
  169.     kPrivateDataAttrTypeNum        = 1051;                            { "Private Data" }
  170.     kDirTypeAttrTypeNum            = 1052;                            { "Directory Type" }
  171.     kDSAMFileAliasAttrTypeNum    = 1053;                            { "DSAM File Alias" }
  172.     kCanAddressToAttrTypeNum    = 1054;                            { "Can Address To" }
  173.     kDiscriminatorAttrTypeNum    = 1055;                            { "Discriminator" }
  174.     kAliasAttrTypeNum            = 1056;                            { "Alias" }
  175.     kParentMSAMAttrTypeNum        = 1057;                            { "Parent MSAM" }
  176.     kParentDSAMAttrTypeNum        = 1058;                            { "Parent DSAM" }
  177.     kSlotAttrTypeNum            = 1059;                            { "Slot" }
  178.     kAssoMailServiceAttrTypeNum    = 1060;                            { "Asso. Mail Service" }
  179.     kFakeAttrTypeNum            = 1061;                            { "Fake" }
  180.     kInheritSysAdminAttrTypeNum    = 1062;                            { "Inherit SysAdministrators" }
  181.     kPreferredPDAttrTypeNum        = 1063;                            { "Preferred PD" }
  182.     kLastLoginAttrTypeNum        = 1064;                            { "Last Login" }
  183.     kMailerAOMStateAttrTypeNum    = 1065;                            { "Mailer AOM State" }
  184.     kMailerSendOptionsAttrTypeNum = 1066;                        { "Mailer Send Options" }
  185.     kJoinedAttrTypeNum            = 1067;                            { "Joined" }
  186.     kUnconfiguredAttrTypeNum    = 1068;                            { "Unconfigured" }
  187.     kVersionAttrTypeNum            = 1069;                            { "Version" }
  188.     kLocationNamesAttrTypeNum    = 1070;                            { "Location Names" }
  189.     kActiveAttrTypeNum            = 1071;                            { "Active" }
  190.     kDeleteRequestedAttrTypeNum    = 1072;                            { "Delete Requested" }
  191.     kGatewayTypeAttrTypeNum        = 1073;                            { "Gateway Type" }
  192.     kFirstOCEAttrTypeNum        = kMemberAttrTypeNum;            { first standard OCE attr type }
  193.     kLastOCEAttrTypeNum            = kGatewayTypeAttrTypeNum;        { last standard OCE attr type }
  194.     kNumOCEAttrTypes            = 0+(kLastOCEAttrTypeNum - kFirstOCEAttrTypeNum + 1);
  195.  
  196. { Miscellaneous enums: }
  197.     kRString32Size                = 32;                            { max size of the body field in RString32 }
  198.     kRString64Size                = 64;                            { max size of the body field in RString64 }
  199.     kNetworkSpecMaxBytes        = 32;                            { max size of the body field in NetworkSpec }
  200.     kPathNameMaxBytes            = 1024;                            { max size of the data field in PackedPathName }
  201.     kDirectoryNameMaxBytes        = 32;                            { max size of the body field in DirectoryName }
  202.     kAttributeTypeMaxBytes        = 32;                            { max size of the body field in AttributeType }
  203.     kAttrValueMaxBytes            = 65536;                        { max size of any attribute value }
  204.     kRStringMaxBytes            = 256;                            { max size (in bytes) of the body field of a recordName or recordType }
  205.     kRStringMaxChars            = 128;                            { max size (in chars) of the body field of a recordName or recordType }
  206.  
  207.     kNULLDNodeNumber            = 0;                            { Special value meaning none specified }
  208.     kRootDNodeNumber            = 2;                            { DNodeNum corresponding to the root of the tree }
  209.  
  210. { This enum is used to select the kind of RString in calls such as OCERelRString,
  211. OCEEqualRString, and OCEValidRString.
  212.  
  213. eGenericSensitive and eGenericInsensitive are enumerators that can be used if you
  214. use RStrings for things other than what you see in this file.  If you want them to
  215. be compared in a case- and diacritical-sensitive manner (c ≠ C ≠ ç), use
  216. eGenericSensitive.  If you want them to be compared in a case- and diacritical-
  217. insensitive manner (c = C = ç), use eGenericInensitive.
  218. WARNING:  do not use eGenericSensitive and eGenericInsensitive with catalog
  219. names, entity names, pathname parts, entity types, network specs, or attribute
  220. types!  Don't assume that you know how they should be compared!!! }
  221.     kOCEDirName                    = 0;
  222.     kOCERecordOrDNodeName        = 1;
  223.     kOCERecordType                = 2;
  224.     kOCENetworkSpec                = 3;
  225.     kOCEAttrType                = 4;
  226.     kOCEGenericSensitive        = 5;
  227.     kOCEGenericInsensitive        = 6;
  228.  
  229.     
  230. TYPE
  231.     RStringKind = INTEGER;
  232.  
  233. { Values for the signature field in Discriminator }
  234.  
  235. CONST
  236.     kDirAllKinds                = 0;
  237.     kDirADAPKind                = 'adap';
  238.     kDirPersonalDirectoryKind    = 'pdir';
  239.     kDirDSAMKind                = 'dsam';
  240.  
  241.     
  242. TYPE
  243.     OCEDirectoryKind = LONGINT;
  244.  
  245. { Values returned by GetDSSpecInfo() }
  246.  
  247. CONST
  248.     kOCEInvalidDSSpec            = $3F3F3F3F;                    { could not be determined }
  249.     kOCEDirsRootDSSpec            = 'root';                        { root of all catalogs ("Catalogs" icon) }
  250.     kOCEDirectoryDSSpec            = 'dire';                        { catalog }
  251.     kOCEDNodeDSSpec                = 'dnod';                        { d-node }
  252.     kOCERecordDSSpec            = 'reco';                        { record }
  253.     kOCEentnDSSpec                = 'entn';                        { extensionType is 'entn' }
  254.     kOCENOTentnDSSpec            = 'not ';
  255.  
  256. { Values for AttributeTag }
  257.     typeRString                    = 'rstr';
  258.     typePackedDSSpec            = 'dspc';
  259.     typeBinary                    = 'bnry';
  260.  
  261. { Bit flag corresponding to the canContainRecords bit.  Use it like this:
  262.     if (foo & kCanContainRecords)
  263.         then this dNode can contain records!
  264. kForeignNode is used to indicate nodes in the name hierarchy that correspond to
  265. foreign catalogs (meaning ADAP sees no clusters or DNodes beneath it, but
  266. mail routers might be able to route to clusters beneath it. }
  267.     kCanContainRecordsBit        = 0;
  268.     kForeignNodeBit                = 1;
  269.  
  270. { DirNodeKind }
  271.     kCanContainRecords            = 1 * (2**(kCanContainRecordsBit));
  272.     kForeignNode                = 1 * (2**(kForeignNodeBit));
  273.  
  274.     
  275. TYPE
  276.     DirNodeKind = LONGINT;
  277.  
  278. {*** Toolbox Control ***}
  279. { We will have a version number and attributes for toolboxes off the aa5e trap
  280. and the S&F server trap.
  281.  
  282. This includes the OCE toolbox and S&F Server.  [Note: the S&F server will
  283. change to ONLY service ServerGateway calls —it will then be necessary to run
  284. it co–resident with an OCE toolbox].
  285.  
  286. The high order word will represent the S&F Server version number.  The low
  287. order word will represent the OCE toolbox version number.  These will be zero
  288. until the component is up and running.  It is not possible to know these
  289. a–priori. Note: there will not be a seperate version numbers for each component
  290. in the OCE toolbox or S&F server.
  291.  
  292. The above is consistent with the standard System 7.0 usage of Gestalt.
  293.  
  294. The oce tb attribute gestaltOCETBPresent implies the existence of OCE on a
  295. machine.
  296.  
  297. The OCE TB attribute gestaltOCETBAvailable implies the availablity of OCE calls.
  298.  
  299. The attribute gestaltOCESFServerAvailable implies the availablity of OCE calls
  300. available through the S&F server. This are essentially the server gateway calls.
  301.  
  302. Any (future) remaining OCE attributes may not be established correctly until
  303. the attribute gestaltOCETBAvailable is set.
  304.  
  305. The gestalt selectors and values are listed below: }
  306.  
  307. CONST
  308.     gestaltOCEToolboxVersion    = 'ocet';                        { OCE Toolbox version }
  309.     gestaltOCEToolboxAttr        = 'oceu';
  310.  
  311. { version includes:
  312.  *  dirtb
  313.  *  authtb
  314.  *  mailtb
  315.  *  ipmtb
  316.  *  personal catalog
  317.  *  ADSPSecure
  318.  * e.g. all interfaces dependent on the aa5e trap. }
  319.     gestaltOCETB                = $0102;                        { OCE Toolbox version 1.02 }
  320.     gestaltSFServer                = $0100;                        { S&F Server version 1.0 }
  321.     gestaltOCETBPresent            = $01;                            { OCE toolbox is present, not running }
  322.     gestaltOCETBAvailable        = $02;                            { OCE toolbox is running and available }
  323.     gestaltOCESFServerAvailable    = $04;                            { S&F Server is running and available }
  324.     gestaltOCETBNativeGlueAvailable = $10;                        { Native PowerPC Glue routines are availible }
  325.  
  326. {    Constants used for Transitions. }
  327.     ATTransIPMStart                = 'ipms';
  328.     ATTransIPMShutdown            = 'ipmd';
  329.     ATTransDirStart                = 'dirs';
  330.     ATTransDirShutdown            = 'dird';
  331.     ATTransAuthStart            = 'auts';
  332.     ATTransAuthShutdown            = 'autd';
  333.     ATTransSFStart                = 's&fs';
  334.     ATTransSFShutdown            = 's&fd';
  335.  
  336. { Some definitions for time-related parameters: }
  337. { Interpreted as UTC seconds since 1/1/1904 }
  338.     
  339. TYPE
  340.     UTCTime = LONGINT;
  341.  
  342. { seconds EAST of Greenwich }
  343.     UTCOffset = LONGINT;
  344.  
  345. { This is the same as the ScriptManager script. }
  346.     CharacterSet = INTEGER;
  347.  
  348. {*** RString ***}
  349. { struct RString is a maximum-sized structure.  Allocate one of these and it will
  350. hold any valid RString. }
  351.     RString = RECORD
  352.         charSet:                CharacterSet;
  353.         dataLength:                INTEGER;
  354.         body:                    ARRAY [0..kRStringMaxBytes-1] OF SInt8; (* Byte *) { place for characters }
  355.     END;
  356.  
  357. { struct ProtoRString is a minimum-sized structure.  Use this for a variable-length RString. }
  358.     ProtoRString = RECORD
  359.         charSet:                CharacterSet;
  360.         dataLength:                INTEGER;
  361.     END;
  362.  
  363.     RStringPtr = ^RString;
  364.     RStringHandle = ^RStringPtr;
  365.  
  366.     ProtoRStringPtr = ^ProtoRString;
  367.  
  368.     RString64 = RECORD
  369.         charSet:                CharacterSet;
  370.         dataLength:                INTEGER;
  371.         body:                    ARRAY [0..kRString64Size-1] OF SInt8; (* Byte *)
  372.     END;
  373.  
  374.     RString32 = RECORD
  375.         charSet:                CharacterSet;
  376.         dataLength:                INTEGER;
  377.         body:                    ARRAY [0..kRString32Size-1] OF SInt8; (* Byte *)
  378.     END;
  379.  
  380. { Standard definitions for the entity type field and attribute type
  381. have been moved to the end of the file. }
  382. { Copies str1 to str2.  str2Length is the size of str2, excluding header.
  383. A memFull error will be returned if that is not as large as str1->dataLength. }
  384.  
  385. FUNCTION OCECopyRString({CONST}VAR str1: RString; VAR str2: RString; str2Length: INTEGER): OSErr;
  386.     {$IFC NOT GENERATINGCFM}
  387.     INLINE $303C, 776, $AA5C;
  388.     {$ENDC}
  389. {    Make an RString from a C string.  If the c string is bigger than rStrLength,
  390. only rStrLength bytes will be copied. (rStrLength does not include the header size) }
  391. PROCEDURE OCECToRString(cStr: ConstCStringPtr; charSet: CharacterSet; VAR rStr: RString; rStrLength: INTEGER);
  392.     {$IFC NOT GENERATINGCFM}
  393.     INLINE $303C, 825, $AA5C;
  394.     {$ENDC}
  395. {    Make an RString from a Pascal string.  If the Pascal string is bigger than rStrLength,
  396. only rStrLength bytes will be copied. (rStrLength does not include the header size) }
  397. PROCEDURE OCEPToRString(pStr: ConstStr255Param; charSet: CharacterSet; VAR rStr: RString; rStrLength: INTEGER);
  398.     {$IFC NOT GENERATINGCFM}
  399.     INLINE $303C, 826, $AA5C;
  400.     {$ENDC}
  401. {    Make a Pascal string from an RString.  It's up to you to check the char set of
  402. the RString, or if the length of the RString is greater than 255 (the Pascal string's
  403. length will simply be the lower byte of the RString's length).  The StringPtr that is
  404. returned will point directly into the RString (no memory will be allocated). }
  405. FUNCTION OCERToPString(rStr: RStringPtr): StringPtr;
  406.     {$IFC NOT GENERATINGCFM}
  407.     INLINE $303C, 827, $AA5C;
  408.     {$ENDC}
  409. {    Check the relative equality of two RStrings.  Determines if str1 is greater than,
  410. equal to, or less than str2.  Result types for OCERelRString are defined in <OSUtils.h>
  411. (same as for RelString). }
  412. FUNCTION OCERelRString(str1: UNIV Ptr; str2: UNIV Ptr; kind: RStringKind): INTEGER;
  413.     {$IFC NOT GENERATINGCFM}
  414.     INLINE $303C, 813, $AA5C;
  415.     {$ENDC}
  416. {    Check for equality of two RStrings. Returns true if equal. }
  417. FUNCTION OCEEqualRString(str1: UNIV Ptr; str2: UNIV Ptr; kind: RStringKind): BOOLEAN;
  418.     {$IFC NOT GENERATINGCFM}
  419.     INLINE $303C, 790, $AA5C;
  420.     {$ENDC}
  421. {    Check the validity of an RString.  Returns true if the RString is valid }
  422. FUNCTION OCEValidRString(str: UNIV Ptr; kind: RStringKind): BOOLEAN;
  423.     {$IFC NOT GENERATINGCFM}
  424.     INLINE $303C, 824, $AA5C;
  425.     {$ENDC}
  426. {*** CreationID ***}
  427.  
  428. TYPE
  429.     CreationID = RECORD
  430.         source:                    LONGINT;                                { Fields definitions and usage are not defined }
  431.         seq:                    LONGINT;
  432.     END;
  433.  
  434.     AttributeCreationID = CreationID;
  435.  
  436. { Returns a pointer to a null CreationID . }
  437.  
  438. FUNCTION OCENullCID: CreationID;
  439.     {$IFC NOT GENERATINGCFM}
  440.     INLINE $303C, 836, $AA5C;
  441.     {$ENDC}
  442. { Returns a pointer to a special CreationID used within the PathFinder. }
  443. FUNCTION OCEPathFinderCID: CreationID;
  444.     {$IFC NOT GENERATINGCFM}
  445.     INLINE $303C, 828, $AA5C;
  446.     {$ENDC}
  447. { Sets the CreationID to a null value. }
  448. PROCEDURE OCESetCreationIDtoNull(VAR cid: CreationID);
  449.     {$IFC NOT GENERATINGCFM}
  450.     INLINE $303C, 814, $AA5C;
  451.     {$ENDC}
  452. { Copies the value of cid1 to cid2. }
  453. PROCEDURE OCECopyCreationID({CONST}VAR cid1: CreationID; VAR cid2: CreationID);
  454.     {$IFC NOT GENERATINGCFM}
  455.     INLINE $303C, 768, $AA5C;
  456.     {$ENDC}
  457. { Check the equality of two CreationIDs. }
  458. FUNCTION OCEEqualCreationID({CONST}VAR cid1: CreationID; {CONST}VAR cid2: CreationID): BOOLEAN;
  459.     {$IFC NOT GENERATINGCFM}
  460.     INLINE $303C, 780, $AA5C;
  461.     {$ENDC}
  462. {*** NetworkSpec ***}
  463. { For the record, a NetworkSpec is an RString with a smaller maximum size.
  464. I don't just typedef it to an RString, because I want the definition of the NetworkSpec
  465. struct to contain the max length.  But it should be possible to typecast any
  466. NetworkSpec to an RString and use all the RString utilities on it. }
  467.  
  468. TYPE
  469.     NetworkSpec = RECORD
  470.         charSet:                CharacterSet;
  471.         dataLength:                INTEGER;
  472.         body:                    ARRAY [0..kNetworkSpecMaxBytes-1] OF SInt8; (* Byte *) { always fixed at the max size }
  473.     END;
  474.  
  475.     NetworkSpecPtr = ^NetworkSpec;
  476.  
  477. {*** PackedPathName ***}
  478. { struct PackedPathName is a maximum-sized structure.  Allocate one of
  479. these and it will hold any valid packed pathname. }
  480.     PackedPathName = RECORD
  481.         dataLength:                INTEGER;
  482.         data:                    ARRAY [0..kPathNameMaxBytes - 2-1] OF SInt8; (* Byte *)
  483.     END;
  484.  
  485. { struct ProtoPackedPathName is a minimum-sized structure.  Use this
  486. for a variable-length packed PathName. }
  487.     ProtoPackedPathName = RECORD
  488.         dataLength:                INTEGER;
  489.     END;
  490.  
  491.     PackedPathNamePtr = ^PackedPathName;
  492.  
  493.     ProtoPackedPathNamePtr = ^ProtoPackedPathName;
  494.  
  495. {
  496. Copy the contents of path1 to path2.  path2Length is the size of path2, and must
  497. be large enough to hold a copy of path1.  A memFull error will be returned if that
  498. is not the case.
  499. }
  500.  
  501. FUNCTION OCECopyPackedPathName({CONST}VAR path1: PackedPathName; VAR path2: PackedPathName; path2Length: INTEGER): OSErr;
  502.     {$IFC NOT GENERATINGCFM}
  503.     INLINE $303C, 772, $AA5C;
  504.     {$ENDC}
  505. {
  506. Returns true if packed path pointer is nil, or is of zero length, or is of
  507. length 2 and nParts of zero.
  508. }
  509. FUNCTION OCEIsNullPackedPathName({CONST}VAR path: PackedPathName): BOOLEAN;
  510.     {$IFC NOT GENERATINGCFM}
  511.     INLINE $303C, 797, $AA5C;
  512.     {$ENDC}
  513. {
  514. OCEUnpackPathName breaks apart the path into its component RStrings, writing string
  515. pointers into the array 'parts', which the client asserts can hold as many as
  516. 'nParts' elements. The number of parts actually found is returned.  Strings are
  517. placed in the array in order from lowest to highest.  The first pathName element
  518. beneath the root appears last.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO
  519. THE PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED
  520. WITH THE UNPACKED STRUCT AS WELL
  521. }
  522. FUNCTION OCEUnpackPathName({CONST}VAR path: PackedPathName; VAR parts: RStringPtr; nParts: INTEGER): INTEGER;
  523.     {$IFC NOT GENERATINGCFM}
  524.     INLINE $303C, 816, $AA5C;
  525.     {$ENDC}
  526. FUNCTION OCEPackedPathNameSize({CONST}VAR parts: RStringPtr; nParts: INTEGER): INTEGER;
  527.     {$IFC NOT GENERATINGCFM}
  528.     INLINE $303C, 808, $AA5C;
  529.     {$ENDC}
  530. { OCEDNodeNameCount returns the number of RStrings contained within the path. }
  531. FUNCTION OCEDNodeNameCount({CONST}VAR path: PackedPathName): INTEGER;
  532.     {$IFC NOT GENERATINGCFM}
  533.     INLINE $303C, 812, $AA5C;
  534.     {$ENDC}
  535. {
  536. OCEPackPathName packs the parts into the storage provided as 'path'.  path must be
  537. large enough to hold the packed pathname.  A memFull error will be returned if
  538. pathLength is too small.  parts[0] should contain the deepest pathName element,
  539. and parts[nParts - 1] should contain the name of the first pathName element beneath
  540. the root. 
  541. }
  542. FUNCTION OCEPackPathName(VAR parts: RStringPtr; nParts: INTEGER; VAR path: PackedPathName; pathLength: INTEGER): OSErr;
  543.     {$IFC NOT GENERATINGCFM}
  544.     INLINE $303C, 803, $AA5C;
  545.     {$ENDC}
  546. {
  547. Check the equality of two packed paths.
  548. }
  549. FUNCTION OCEEqualPackedPathName({CONST}VAR path1: PackedPathName; {CONST}VAR path2: PackedPathName): BOOLEAN;
  550.     {$IFC NOT GENERATINGCFM}
  551.     INLINE $303C, 785, $AA5C;
  552.     {$ENDC}
  553. {
  554. OCEValidPackedPathName checks that the packed PathName is internally consistent.
  555. Returns true if it's ok.
  556. }
  557. FUNCTION OCEValidPackedPathName({CONST}VAR path: PackedPathName): BOOLEAN;
  558.     {$IFC NOT GENERATINGCFM}
  559.     INLINE $303C, 820, $AA5C;
  560.     {$ENDC}
  561. {*** DirDiscriminator ***}
  562.  
  563. TYPE
  564.     DirDiscriminator = RECORD
  565.         signature:                OCEDirectoryKind;
  566.         misc:                    LONGINT;
  567.     END;
  568.  
  569. { Copies the value of disc1 to disc2. }
  570.  
  571. PROCEDURE OCECopyDirDiscriminator({CONST}VAR disc1: DirDiscriminator; VAR disc2: DirDiscriminator);
  572.     {$IFC NOT GENERATINGCFM}
  573.     INLINE $303C, 769, $AA5C;
  574.     {$ENDC}
  575. { Check the equality of two DirDiscriminators. }
  576. FUNCTION OCEEqualDirDiscriminator({CONST}VAR disc1: DirDiscriminator; {CONST}VAR disc2: DirDiscriminator): BOOLEAN;
  577.     {$IFC NOT GENERATINGCFM}
  578.     INLINE $303C, 781, $AA5C;
  579.     {$ENDC}
  580. {
  581. This structure is called RLI because it really contains all the info you
  582. need to locate a record within the entire name space.  It contains four fields.
  583. The first two are the name of the catalog and a catalog discriminator.  These
  584. two fields are used to indicate to which catalog a given record belongs.  The
  585. discriminator is used to distinguish between two different catalogs that have
  586. the same name.
  587.  
  588. The other two fields in the RLI structure are used to indicate a particular
  589. catalog node within the catalog specified by the directoryName and
  590. discriminator fields.  These fields are exactly analagous to the dirID and
  591. pathname used in HFS.  It is possible to specify a dNode just by dNodeNumber
  592. (pathname is nil), or just by pathname (dNodeNumber is set to kNULLDNodeNumber),
  593. or by a combination of the two.  The latter is called a 'partial pathname', and
  594. while it is valid in the Catalog Manager API, it is not supported by ADAP
  595. catalogs in Release 1.
  596.  
  597. Note that the path parameter does not include the catalog name, but holds
  598. the names of all the nodes on the path to the desired catalog node, starting
  599. with the catalog node and working its way up the tree.
  600. }
  601. {*** RLI ***}
  602.  
  603. TYPE
  604.     DirectoryName = RECORD
  605.         charSet:                CharacterSet;
  606.         dataLength:                INTEGER;
  607.         body:                    ARRAY [0..kDirectoryNameMaxBytes-1] OF SInt8; (* Byte *) { space for catalog name }
  608.     END;
  609.  
  610.     DirectoryNamePtr = ^DirectoryName;
  611.  
  612. { Catalog node number }
  613.     DNodeNum = LONGINT;
  614.  
  615.     RLI = RECORD
  616.         directoryName:            DirectoryNamePtr;                        { pointer to the name of the catalog root }
  617.         discriminator:            DirDiscriminator;                        { used to discriminate between dup catalog names }
  618.         dNodeNumber:            DNodeNum;                                { number of the node }
  619.         path:                    PackedPathNamePtr;                        { old-style RLI }
  620.     END;
  621.  
  622.     RLIPtr = ^RLI;
  623.  
  624. {
  625. Create a new RLI from the catalog name, discriminator, DNode number, and
  626. PackedPathName.  You must allocate the storage for the RLI and pass in a pointer
  627. to it.
  628. }
  629.  
  630. PROCEDURE OCENewRLI(VAR newRLI: RLI; {CONST}VAR dirName: DirectoryName; VAR discriminator: DirDiscriminator; dNodeNumber: DNodeNum; {CONST}VAR path: PackedPathName);
  631.     {$IFC NOT GENERATINGCFM}
  632.     INLINE $303C, 799, $AA5C;
  633.     {$ENDC}
  634. {
  635. Duplicate the contents of rli1 to rli2.  No errors are returned. This
  636. simply copies the pointers to the catalog name and path, wiping out any pointer
  637. that you might have had in there.
  638. }
  639. PROCEDURE OCEDuplicateRLI({CONST}VAR rli1: RLI; VAR rli2: RLI);
  640.     {$IFC NOT GENERATINGCFM}
  641.     INLINE $303C, 779, $AA5C;
  642.     {$ENDC}
  643. {
  644. Copy the contents of rli1 to rli2.  rli2 must already contain
  645. pointers to structures large enough to hold copies of the corresponding
  646. fields from rli1.  A memFull error will be returned if that is not the case.
  647. So if you allocate a brand new empty destination, you must at least set up
  648. its length fields.
  649. }
  650. FUNCTION OCECopyRLI({CONST}VAR rli1: RLI; VAR rli2: RLI): OSErr;
  651.     {$IFC NOT GENERATINGCFM}
  652.     INLINE $303C, 775, $AA5C;
  653.     {$ENDC}
  654. {
  655. Check the equality of two RLIs.  This will take into account differences
  656. in the case and diacriticals of the directoryName and the PathName.
  657. NOTE THAT THIS WILL FAIL IF rli1 CONTAINS A DNODENUMBER AND A NIL PATHNAME,
  658. AND rli2 CONTAINS kNULLDNodeNumber AND A NON-NIL PATHNAME.  IN OTHER WORDS,
  659. THE TWO rlis MUST BE OF THE SAME FORM TO CHECK FOR EQUALITY.
  660. The one exception is that if the pathname is nil, a dNodeNumber of zero and
  661. kRootDNodeNumber will be treated as equal.
  662. }
  663. FUNCTION OCEEqualRLI({CONST}VAR rli1: RLI; {CONST}VAR rli2: RLI): BOOLEAN;
  664.     {$IFC NOT GENERATINGCFM}
  665.     INLINE $303C, 789, $AA5C;
  666.     {$ENDC}
  667. {
  668. Check the validity of an RLI.  This checks that the catalog name length
  669. is within bounds, and the packed pathname (if specified) is valid.
  670. }
  671. FUNCTION OCEValidRLI({CONST}VAR theRLI: RLI): BOOLEAN;
  672.     {$IFC NOT GENERATINGCFM}
  673.     INLINE $303C, 823, $AA5C;
  674.     {$ENDC}
  675. {*** PackedRLI ***}
  676. {
  677. struct PackedRLI is a maximum-sized structure.  Allocate one of
  678. these and it will hold any valid packed pathname.
  679. }
  680.  
  681. CONST
  682.     kRLIMaxBytes                = 0+(sizeof(RString) + sizeof(DirDiscriminator) + sizeof(DNodeNum) + kPathNameMaxBytes);
  683.  
  684.  
  685. TYPE
  686.     PackedRLI = RECORD
  687.         dataLength:                INTEGER;
  688.         data:                    ARRAY [0..kRLIMaxBytes-1] OF SInt8; (* Byte *)
  689.     END;
  690.  
  691. {
  692. struct ProtoPackedRLI is a minimum-sized structure.  Use this
  693. for a variable-length packed RLI.
  694. }
  695.     ProtoPackedRLI = RECORD
  696.         dataLength:                INTEGER;
  697.     END;
  698.  
  699.     PackedRLIPtr = ^PackedRLI;
  700.  
  701.     ProtoPackedRLIPtr = ^ProtoPackedRLI;
  702.  
  703. {
  704. Copy the contents of prli1 to prli2.  prli2Length is the size of prli2, and must
  705. be large enough to hold a copy of prli1.  A memFull error will be returned if that
  706. is not the case.
  707. }
  708.  
  709. FUNCTION OCECopyPackedRLI({CONST}VAR prli1: PackedRLI; VAR prli2: PackedRLI; prli2Length: INTEGER): OSErr;
  710.     {$IFC NOT GENERATINGCFM}
  711.     INLINE $303C, 773, $AA5C;
  712.     {$ENDC}
  713. {
  714. OCEUnpackRLI breaks apart the prli into its components, writing pointers into
  715. the rli structure.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE
  716. PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED
  717. WITH THE UNPACKED STRUCT AS WELL
  718. }
  719. PROCEDURE OCEUnpackRLI({CONST}VAR prli: PackedRLI; VAR theRLI: RLI);
  720.     {$IFC NOT GENERATINGCFM}
  721.     INLINE $303C, 817, $AA5C;
  722.     {$ENDC}
  723. {
  724. OCEPackedRLISize computes the number of bytes of memory needed to hold a
  725. PackedRLI manufactured from an RLI.  This length
  726. includes the length of the length field of PackedRLI, so it
  727. is safe to do a NewPtr (OCEPackedRLISize(...)).
  728. }
  729. FUNCTION OCEPackedRLISize({CONST}VAR theRLI: RLI): INTEGER;
  730.     {$IFC NOT GENERATINGCFM}
  731.     INLINE $303C, 810, $AA5C;
  732.     {$ENDC}
  733. {
  734. OCEPackRLI packs the RLI into the storage provided as 'prli'.  prli must be
  735. large enough to hold the packed RLI.  A memFull error will be returned if
  736. prliLength is too small.
  737. }
  738. FUNCTION OCEPackRLI({CONST}VAR theRLI: RLI; VAR prli: PackedRLI; prliLength: INTEGER): OSErr;
  739.     {$IFC NOT GENERATINGCFM}
  740.     INLINE $303C, 804, $AA5C;
  741.     {$ENDC}
  742. {
  743. OCEPackedRLIPartsSize computes the number of bytes of memory needed to hold a
  744. PackedRLI manufactured from the parts of an RLI.  This length
  745. includes the length of the length field of PackedRLI, so it
  746. is safe to do a NewPtr (OCEPackedRLIPartsSize(...)).
  747. }
  748. FUNCTION OCEPackedRLIPartsSize({CONST}VAR dirName: DirectoryName; VAR parts: RStringPtr; nParts: INTEGER): INTEGER;
  749.     {$IFC NOT GENERATINGCFM}
  750.     INLINE $303C, 809, $AA5C;
  751.     {$ENDC}
  752. {
  753. OCEPackRLIParts packs the parts of an RLI into the storage provided as 'prli'.
  754. prli must be large enough to hold the packed RLI.  A memFull error will be returned
  755. if prliLength is too small.
  756. }
  757. FUNCTION OCEPackRLIParts({CONST}VAR dirName: DirectoryName; {CONST}VAR discriminator: DirDiscriminator; dNodeNumber: DNodeNum; VAR parts: RStringPtr; nParts: INTEGER; VAR prli: PackedRLI; prliLength: INTEGER): OSErr;
  758.     {$IFC NOT GENERATINGCFM}
  759.     INLINE $303C, 805, $AA5C;
  760.     {$ENDC}
  761. {
  762. Check the equality of two packed prlis.
  763. }
  764. FUNCTION OCEEqualPackedRLI({CONST}VAR prli1: PackedRLI; {CONST}VAR prli2: PackedRLI): BOOLEAN;
  765.     {$IFC NOT GENERATINGCFM}
  766.     INLINE $303C, 787, $AA5C;
  767.     {$ENDC}
  768. {
  769. Check the validity of a packed RLI.  This checks that the catalog name length
  770. is within bounds, and the packed pathname (if specified) is valid.
  771. }
  772. FUNCTION OCEValidPackedRLI({CONST}VAR prli: PackedRLI): BOOLEAN;
  773.     {$IFC NOT GENERATINGCFM}
  774.     INLINE $303C, 822, $AA5C;
  775.     {$ENDC}
  776. {
  777. If this packed RLI describes a Personal Catalog, this call will return a pointer
  778. to an alias record that can be used to find the actual file.  Otherwise, it returns nil.
  779. }
  780. FUNCTION OCEExtractAlias({CONST}VAR prli: PackedRLI): AliasPtr;
  781.     {$IFC NOT GENERATINGCFM}
  782.     INLINE $303C, 792, $AA5C;
  783.     {$ENDC}
  784. {
  785. This call returns a pointer to a packed RLI that represents the "Catalogs" icon, or
  786. the root of all catalogs.  It is used in the CollabPack.
  787. }
  788. FUNCTION OCEGetDirectoryRootPackedRLI: PackedRLI;
  789.     {$IFC NOT GENERATINGCFM}
  790.     INLINE $303C, 838, $AA5C;
  791.     {$ENDC}
  792. {*** LocalRecordID ***}
  793.  
  794. TYPE
  795.     LocalRecordID = RECORD
  796.         cid:                    CreationID;
  797.         recordName:                RStringPtr;
  798.         recordType:                RStringPtr;
  799.     END;
  800.  
  801.     LocalRecordIDPtr = ^LocalRecordID;
  802.  
  803. { Create a LocalRecordID from a name, type, and CreationID }
  804.  
  805. PROCEDURE OCENewLocalRecordID({CONST}VAR recordName: RString; {CONST}VAR recordType: RString; {CONST}VAR cid: CreationID; VAR lRID: LocalRecordID);
  806.     {$IFC NOT GENERATINGCFM}
  807.     INLINE $303C, 798, $AA5C;
  808.     {$ENDC}
  809. {
  810. Copy LocalRecordID lRID1 to LocalRecordID lRID2.  lRID2 must already contain
  811. pointers to RString structures large enough to hold copies of the corresponding
  812. fields from lRID1.  A memFull error will be returned if that is not the case.
  813. So if you allocate a brand new empty destination, you must at least set up
  814. its length field.
  815. }
  816. FUNCTION OCECopyLocalRecordID({CONST}VAR lRID1: LocalRecordID; VAR lRID2: LocalRecordID): OSErr;
  817.     {$IFC NOT GENERATINGCFM}
  818.     INLINE $303C, 770, $AA5C;
  819.     {$ENDC}
  820. {
  821. Check the equality of two local RIDs.
  822. }
  823. FUNCTION OCEEqualLocalRecordID({CONST}VAR lRID1: LocalRecordID; {CONST}VAR lRID2: LocalRecordID): BOOLEAN;
  824.     {$IFC NOT GENERATINGCFM}
  825.     INLINE $303C, 783, $AA5C;
  826.     {$ENDC}
  827. {*** ShortRecordID ***}
  828.  
  829. TYPE
  830.     ShortRecordID = RECORD
  831.         rli:                    PackedRLIPtr;
  832.         cid:                    CreationID;
  833.     END;
  834.  
  835.     ShortRecordIDPtr = ^ShortRecordID;
  836.  
  837. { Create a ShortRecordID from an RLI struct and a CreationID }
  838.  
  839. PROCEDURE OCENewShortRecordID({CONST}VAR theRLI: PackedRLI; {CONST}VAR cid: CreationID; sRID: ShortRecordIDPtr);
  840.     {$IFC NOT GENERATINGCFM}
  841.     INLINE $303C, 801, $AA5C;
  842.     {$ENDC}
  843. {
  844. Copy ShortRecordID sRID1 to ShortRecordID sRID2.  sRID2 must already contain
  845. pointers to structures large enough to hold copies of the corresponding
  846. fields from sRID1.  A memFull error will be returned if that is not the case.
  847. So if you allocate a brand new empty destination, you must at least set up
  848. its length fields.
  849. }
  850. FUNCTION OCECopyShortRecordID({CONST}VAR sRID1: ShortRecordID; VAR sRID2: ShortRecordID): OSErr;
  851.     {$IFC NOT GENERATINGCFM}
  852.     INLINE $303C, 778, $AA5C;
  853.     {$ENDC}
  854. {
  855. Check the equality of two short RIDs.
  856. }
  857. FUNCTION OCEEqualShortRecordID({CONST}VAR sRID1: ShortRecordID; {CONST}VAR sRID2: ShortRecordID): BOOLEAN;
  858.     {$IFC NOT GENERATINGCFM}
  859.     INLINE $303C, 791, $AA5C;
  860.     {$ENDC}
  861. {*** RecordID ***}
  862.  
  863. TYPE
  864.     RecordID = RECORD
  865.         rli:                    PackedRLIPtr;                            { pointer to a packed rli structure }
  866.         local:                    LocalRecordID;
  867.     END;
  868.  
  869.     RecordIDPtr = ^RecordID;
  870.  
  871. {    Create a RecordID from a packed RLI struct and a LocalRecordID.
  872. This doesn't allocate any new space; the RecordID points to the same
  873. packed RLI struct and the same name and type RStrings. }
  874.  
  875. PROCEDURE OCENewRecordID({CONST}VAR theRLI: PackedRLI; {CONST}VAR lRID: LocalRecordID; VAR rid: RecordID);
  876.     {$IFC NOT GENERATINGCFM}
  877.     INLINE $303C, 800, $AA5C;
  878.     {$ENDC}
  879. {
  880. Copy RecordID RID1 to RecordID RID2.  RID2 must already contain
  881. pointers to structures large enough to hold copies of the corresponding
  882. fields from lRID1.  A memFull error will be returned if that is not the case.
  883. So if you allocate a brand new empty destination, you must at least set up
  884. its length fields.
  885. }
  886. FUNCTION OCECopyRecordID({CONST}VAR rid1: RecordID; {CONST}VAR rid2: RecordID): OSErr;
  887.     {$IFC NOT GENERATINGCFM}
  888.     INLINE $303C, 777, $AA5C;
  889.     {$ENDC}
  890. {    Check the equality of two RIDs. }
  891. FUNCTION OCEEqualRecordID({CONST}VAR rid1: RecordID; {CONST}VAR rid2: RecordID): BOOLEAN;
  892.     {$IFC NOT GENERATINGCFM}
  893.     INLINE $303C, 788, $AA5C;
  894.     {$ENDC}
  895. {*** PackedRecordID ***}
  896. {
  897. struct PackedRecordID is a maximum-sized structure.  Allocate one of
  898. these and it will hold any valid packed RecordID.
  899. }
  900.  
  901. CONST
  902.     kPackedRecordIDMaxBytes        = 0+(kPathNameMaxBytes + sizeof(DNodeNum) + sizeof(DirDiscriminator) + sizeof(CreationID) + (3 * sizeof(RString)));
  903.  
  904.  
  905. TYPE
  906.     PackedRecordID = RECORD
  907.         dataLength:                INTEGER;
  908.         data:                    ARRAY [0..kPackedRecordIDMaxBytes-1] OF SInt8; (* Byte *)
  909.     END;
  910.  
  911. {
  912. struct ProtoPackedRecordID is a minimum-sized structure.  Use this
  913. for a variable-length packed RecordID.
  914. }
  915.     ProtoPackedRecordID = RECORD
  916.         dataLength:                INTEGER;
  917.     END;
  918.  
  919.     PackedRecordIDPtr = ^PackedRecordID;
  920.  
  921.     ProtoPackedRecordIDPtr = ^ProtoPackedRecordID;
  922.  
  923. {
  924. Copy PackedRecordID pRID1 to PackedRecordID pRID2.  pRID2 must already contain
  925. pointers to structures large enough to hold copies of the corresponding
  926. fields from pRID1.  A memFull error will be returned if that is not the case.
  927. pRID2Length is the number of bytes that can be put into pRID2, not counting the
  928. packed RecordID header.
  929. }
  930.  
  931. FUNCTION OCECopyPackedRecordID({CONST}VAR pRID1: PackedRecordID; {CONST}VAR pRID2: PackedRecordID; pRID2Length: INTEGER): OSErr;
  932.     {$IFC NOT GENERATINGCFM}
  933.     INLINE $303C, 774, $AA5C;
  934.     {$ENDC}
  935. {
  936. Create a RecordID from a PackedRecordID.
  937. NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE
  938. OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL
  939. }
  940. PROCEDURE OCEUnpackRecordID({CONST}VAR pRID: PackedRecordID; VAR rid: RecordID);
  941.     {$IFC NOT GENERATINGCFM}
  942.     INLINE $303C, 818, $AA5C;
  943.     {$ENDC}
  944. {
  945. Create a PackedRecordID from a RecordID.  pRID must be large enough to contain
  946. the packed RecordID.  A memFull error will be returned if that is not the case.
  947. packedRecordIDLength is the number of bytes that can be put into pRID, not
  948. counting the header.
  949. }
  950. FUNCTION OCEPackRecordID({CONST}VAR rid: RecordID; VAR pRID: PackedRecordID; packedRecordIDLength: INTEGER): OSErr;
  951.     {$IFC NOT GENERATINGCFM}
  952.     INLINE $303C, 806, $AA5C;
  953.     {$ENDC}
  954. {
  955. Compute the number of bytes of memory needed to hold a RecordID when packed. This
  956. length includes the length of the length field of PackedRecordID, so it
  957. is safe to do a NewPtr (OCEPackedRecordIDSize(...)).
  958. }
  959. FUNCTION OCEPackedRecordIDSize({CONST}VAR rid: RecordID): INTEGER;
  960.     {$IFC NOT GENERATINGCFM}
  961.     INLINE $303C, 811, $AA5C;
  962.     {$ENDC}
  963. {
  964. Check the equality of two packed RIDs.
  965. }
  966. FUNCTION OCEEqualPackedRecordID({CONST}VAR pRID1: PackedRecordID; {CONST}VAR pRID2: PackedRecordID): BOOLEAN;
  967.     {$IFC NOT GENERATINGCFM}
  968.     INLINE $303C, 786, $AA5C;
  969.     {$ENDC}
  970. { OCEValidPackedRecordID checks the validity of a packed record ID. }
  971. FUNCTION OCEValidPackedRecordID({CONST}VAR pRID: PackedRecordID): BOOLEAN;
  972.     {$IFC NOT GENERATINGCFM}
  973.     INLINE $303C, 821, $AA5C;
  974.     {$ENDC}
  975. {*** DSSpec ***}
  976.  
  977. TYPE
  978.     DSSpec = RECORD
  979.         entitySpecifier:        ^RecordID;
  980.         extensionType:            OSType;
  981.         extensionSize:            INTEGER;
  982.         extensionValue:            Ptr;
  983.     END;
  984.  
  985.     DSSpecPtr = ^DSSpec;
  986.  
  987. {
  988. struct PackedDSSpec is NOT a maximum-sized structure.  Allocate one of
  989. these and it will hold any valid packed RecordID, but not necessarily any additional
  990. data.
  991. }
  992.  
  993. CONST
  994.     kPackedDSSpecMaxBytes        = 0+(sizeof(PackedRecordID) + sizeof(OSType) + sizeof(UInt16));
  995.  
  996.  
  997. TYPE
  998.     PackedDSSpec = RECORD
  999.         dataLength:                INTEGER;
  1000.         data:                    ARRAY [0..kPackedDSSpecMaxBytes-1] OF SInt8; (* Byte *)
  1001.     END;
  1002.  
  1003. {
  1004. struct ProtoPackedDSSpec is a minimum-sized structure.  Use this
  1005. for a variable-length packed DSSpec.
  1006. }
  1007.     ProtoPackedDSSpec = RECORD
  1008.         dataLength:                INTEGER;
  1009.     END;
  1010.  
  1011.     PackedDSSpecPtr = ^PackedDSSpec;
  1012.  
  1013.     ProtoPackedDSSpecPtr = ^ProtoPackedDSSpec;
  1014.  
  1015. {
  1016. Copy PackedDSSpec pdss1 to PackedDSSpec pdss2.  pdss2 must already contain
  1017. pointers to structures large enough to hold copies of the corresponding
  1018. fields from pdss1.  A memFull error will be returned if that is not the case.
  1019. pdss2Length is the number of bytes that can be put into pdss2, not counting the
  1020. packed DSSpec header.
  1021. }
  1022.  
  1023. FUNCTION OCECopyPackedDSSpec({CONST}VAR pdss1: PackedDSSpec; {CONST}VAR pdss2: PackedDSSpec; pdss2Length: INTEGER): OSErr;
  1024.     {$IFC NOT GENERATINGCFM}
  1025.     INLINE $303C, 771, $AA5C;
  1026.     {$ENDC}
  1027. {
  1028. Create a DSSpec from a PackedDSSpec.
  1029. NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE
  1030. OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL.
  1031. A pointer to the extension is returned in dss->extensionValue, and the length of that
  1032. extension is returned in dss->extensionSize.  If there is no extension, dss->extensionValue will
  1033. be set to nil.  This routine will unpack the RecordID (if any) into rid, unpack the rest
  1034. into dss, and set dss->entitySpecifier to rid.
  1035. }
  1036. PROCEDURE OCEUnpackDSSpec({CONST}VAR pdss: PackedDSSpec; VAR dss: DSSpec; VAR rid: RecordID);
  1037.     {$IFC NOT GENERATINGCFM}
  1038.     INLINE $303C, 815, $AA5C;
  1039.     {$ENDC}
  1040. {
  1041. Create a PackedDSSpec from a DSSpec.  pdss must be large enough to
  1042. contain the packed RecordID and any extension.  A memFull error will be returned if that
  1043. is not the case.  pdssLength is the number of bytes that can be put into pdss,
  1044. not counting the header.
  1045. }
  1046. FUNCTION OCEPackDSSpec({CONST}VAR dss: DSSpec; VAR pdss: PackedDSSpec; pdssLength: INTEGER): OSErr;
  1047.     {$IFC NOT GENERATINGCFM}
  1048.     INLINE $303C, 802, $AA5C;
  1049.     {$ENDC}
  1050. {
  1051. Compute the number of bytes of memory needed to hold a DSSpec when packed. This
  1052. length includes the length of the length field of PackedDSSpec, so it
  1053. is safe to do a NewPtr (OCEPackedDSSpecSize(...)).
  1054. }
  1055. FUNCTION OCEPackedDSSpecSize({CONST}VAR dss: DSSpec): INTEGER;
  1056.     {$IFC NOT GENERATINGCFM}
  1057.     INLINE $303C, 807, $AA5C;
  1058.     {$ENDC}
  1059. {    Check the equality of two DSSpecs.  This compares all fields, even the
  1060. extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and
  1061. diacrit-insensitive manner. }
  1062. FUNCTION OCEEqualDSSpec({CONST}VAR pdss1: DSSpec; {CONST}VAR pdss2: DSSpec): BOOLEAN;
  1063.     {$IFC NOT GENERATINGCFM}
  1064.     INLINE $303C, 782, $AA5C;
  1065.     {$ENDC}
  1066. {    Check the equality of two PackedDSSpecs.  This compares all fields, even the
  1067. extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and
  1068. diacrit-insensitive manner. }
  1069. FUNCTION OCEEqualPackedDSSpec({CONST}VAR pdss1: PackedDSSpec; {CONST}VAR pdss2: PackedDSSpec): BOOLEAN;
  1070.     {$IFC NOT GENERATINGCFM}
  1071.     INLINE $303C, 784, $AA5C;
  1072.     {$ENDC}
  1073. {
  1074. Check the validity of a PackedDSSpec.  If extensionType is
  1075. 'entn', pdss must contain a valid entitySpecifier.  For all other extensionTypes, a nil
  1076. entitySpecifier is valid, but if non-nil, it will be checked for validity.  No check
  1077. is made on the extension.
  1078. }
  1079. FUNCTION OCEValidPackedDSSpec({CONST}VAR pdss: PackedDSSpec): BOOLEAN;
  1080.     {$IFC NOT GENERATINGCFM}
  1081.     INLINE $303C, 819, $AA5C;
  1082.     {$ENDC}
  1083. {
  1084. Return info about a DSSpec.  This routine does not check validity.  If the
  1085. DSSpec has no extension, we determine whether it represents the root of all
  1086. catalogs, a single catalog, a DNode, or a Record.  Else it is invalid.
  1087. If the DSSpec has an extension, we simply return the extension type.
  1088. }
  1089. FUNCTION OCEGetDSSpecInfo({CONST}VAR spec: DSSpec): OSType;
  1090.     {$IFC NOT GENERATINGCFM}
  1091.     INLINE $303C, 793, $AA5C;
  1092.     {$ENDC}
  1093. { OCEGetExtensionType returns the extensionType imbedded in the PackedDSSpec. }
  1094. FUNCTION OCEGetExtensionType({CONST}VAR pdss: PackedDSSpec): OSType;
  1095.     {$IFC NOT GENERATINGCFM}
  1096.     INLINE $303C, 796, $AA5C;
  1097.     {$ENDC}
  1098. {
  1099. OCEStreamPackedDSSpec streams (flattens) a catalog object a little at a time by
  1100. calling the DSSpecStreamer routine that you provide.
  1101. }
  1102. TYPE
  1103.     DSSpecStreamerProcPtr = ProcPtr;  { FUNCTION DSSpecStreamer(buffer: UNIV Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT): OSErr; }
  1104.     DSSpecStreamerUPP = UniversalProcPtr;
  1105.  
  1106. CONST
  1107.     uppDSSpecStreamerProcInfo = $000037E0; { FUNCTION (4 byte param, 4 byte param, 1 byte param, 4 byte param): 2 byte result; }
  1108.  
  1109. FUNCTION NewDSSpecStreamerProc(userRoutine: DSSpecStreamerProcPtr): DSSpecStreamerUPP;
  1110.     {$IFC NOT GENERATINGCFM }
  1111.     INLINE $2E9F;
  1112.     {$ENDC}
  1113.  
  1114. FUNCTION CallDSSpecStreamerProc(buffer: UNIV Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT; userRoutine: DSSpecStreamerUPP): OSErr;
  1115.     {$IFC NOT GENERATINGCFM}
  1116.     INLINE $205F, $4E90;
  1117.     {$ENDC}
  1118.     
  1119. TYPE
  1120.     DSSpecStreamer = DSSpecStreamerUPP;
  1121.  
  1122.  
  1123. FUNCTION OCEStreamPackedDSSpec({CONST}VAR dss: DSSpec; stream: DSSpecStreamer; userData: LONGINT; VAR actualCount: LONGINT): OSErr;
  1124.     {$IFC NOT GENERATINGCFM}
  1125.     INLINE $303C, 829, $AA5C;
  1126.     {$ENDC}
  1127. {*** AttributeType ***}
  1128. {
  1129. For the record, an AttributeType is an RString with a smaller maximum size.
  1130. I don't just typedef it to an RString, because I want the definition of the AttributeType
  1131. struct to contain the max length, because I need to include it in the Attribute struct
  1132. below.  But it should be possible to typecast any AttributeType to an RString and use
  1133. all the RString utilities on it.
  1134. }
  1135.  
  1136. TYPE
  1137.     AttributeType = RECORD
  1138.         charSet:                CharacterSet;
  1139.         dataLength:                INTEGER;
  1140.         body:                    ARRAY [0..kAttributeTypeMaxBytes-1] OF SInt8; (* Byte *) { always fixed at the max size }
  1141.     END;
  1142.  
  1143.     AttributeTypePtr = ^AttributeType;
  1144.  
  1145. { Miscellaneous defines:  (these cannot be made into enums) }
  1146.  
  1147. CONST
  1148.     kMinPackedRStringLength        = 0+(sizeof(ProtoRString));
  1149.  
  1150.     kMinPackedRLISize            = 0+(sizeof(ProtoPackedRLI) + sizeof(DirDiscriminator) + sizeof(DNodeNum) + kMinPackedRStringLength + sizeof(ProtoPackedPathName));
  1151.  
  1152. {*** AttributeValue ***}
  1153. { same class as is used in AppleEvents }
  1154.     
  1155. TYPE
  1156.     AttributeTag = DescType;
  1157.  
  1158.     AttributeValue = RECORD
  1159.         tag:                    AttributeTag;
  1160.         dataLength:                LONGINT;
  1161.         bytes:                    Ptr;
  1162.     END;
  1163.  
  1164.     AttributeValuePtr = ^AttributeValue;
  1165.  
  1166. {*** Attribute ***}
  1167.     Attribute = RECORD
  1168.         attributeType:            AttributeType;
  1169.         cid:                    AttributeCreationID;
  1170.         value:                    AttributeValue;
  1171.     END;
  1172.  
  1173.     AttributePtr = ^Attribute;
  1174.  
  1175.  
  1176. FUNCTION OCEGetIndRecordType(stringIndex: OCERecordTypeIndex): RString;
  1177.     {$IFC NOT GENERATINGCFM}
  1178.     INLINE $303C, 795, $AA5C;
  1179.     {$ENDC}
  1180. FUNCTION OCEGetIndAttributeType(stringIndex: OCEAttributeTypeIndex): AttributeType;
  1181.     {$IFC NOT GENERATINGCFM}
  1182.     INLINE $303C, 794, $AA5C;
  1183.     {$ENDC}
  1184.  
  1185. CONST
  1186.     _oceTBDispatch                = $AA5E;
  1187.  
  1188. {***************************************************************************************
  1189.    PLEASE NOTE! ROUTINES HAVE MOVED TO THIS HEADER!
  1190.  
  1191.    OCESizePackedRecipient, OCEPackRecipient, OCEUnpackRecipient, OCEStreamRecipient,
  1192.    OCEGetRecipientType, and OCESetRecipientType have moved to the OCE header file.
  1193.    The OCEMessaging header includes the OCE header, so no changes to your code are
  1194.    required.
  1195.  
  1196. ***************************************************************************************}
  1197.     
  1198. TYPE
  1199.     OCERecipient = DSSpec;
  1200.  
  1201.  
  1202. CONST
  1203.     kOCESizePackedRecipient        = 830;
  1204.     kOCEPackRecipient            = 831;
  1205.     kOCEUnpackRecipient            = 832;
  1206.     kOCEStreamRecipient            = 833;
  1207.     kOCEGetRecipientType        = 834;
  1208.     kOCESetRecipientType        = 835;
  1209.  
  1210. {
  1211. Compute the space that a OCERecipient would take if it were in packed
  1212. form.  [Note: does NOT even pad extensionSize, so you may get an odd #back out]
  1213. Safe to pass dereferenced handle(s).
  1214. }
  1215.  
  1216. FUNCTION OCESizePackedRecipient({CONST}VAR rcpt: OCERecipient): INTEGER;
  1217.     {$IFC NOT GENERATINGCFM}
  1218.     INLINE $303C, 830, $AA5C;
  1219.     {$ENDC}
  1220. {
  1221. Take an OCERecipient (scatter) and (gather) stream into the specified
  1222. buffer.  It is assumed that there is sufficient space in the buffer (that is
  1223. OCESizePackedRecipient).  Safe to pass dereferenced handle(s).
  1224. }
  1225. FUNCTION OCEPackRecipient({CONST}VAR rcpt: OCERecipient; buffer: UNIV Ptr): INTEGER;
  1226.     {$IFC NOT GENERATINGCFM}
  1227.     INLINE $303C, 831, $AA5C;
  1228.     {$ENDC}
  1229. {
  1230. Take a packed OCERecipient and cast a the OCERecipient frame over it. Returns
  1231. amBadDestId if it doesn't look like an OCERecipient. Safe to pass dereferenced
  1232. handle(s).
  1233. }
  1234. FUNCTION OCEUnpackRecipient(buffer: UNIV Ptr; VAR rcpt: OCERecipient; VAR entitySpecifier: RecordID): OSErr;
  1235.     {$IFC NOT GENERATINGCFM}
  1236.     INLINE $303C, 832, $AA5C;
  1237.     {$ENDC}
  1238. {
  1239. Take an OCERecipient (scatter) and (gather) stream using the specified
  1240. function.  Safe to pass dereferenced handle(s).  If streamer function returns
  1241. OCEError OCEStreamRecipient stops execution and passes the error back to the caller
  1242. }
  1243. TYPE
  1244.     OCERecipientStreamerProcPtr = ProcPtr;  { FUNCTION OCERecipientStreamer(buffer: UNIV Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT): OSErr; }
  1245.     OCERecipientStreamerUPP = UniversalProcPtr;
  1246.  
  1247. CONST
  1248.     uppOCERecipientStreamerProcInfo = $000037E0; { FUNCTION (4 byte param, 4 byte param, 1 byte param, 4 byte param): 2 byte result; }
  1249.  
  1250. FUNCTION NewOCERecipientStreamerProc(userRoutine: OCERecipientStreamerProcPtr): OCERecipientStreamerUPP;
  1251.     {$IFC NOT GENERATINGCFM }
  1252.     INLINE $2E9F;
  1253.     {$ENDC}
  1254.  
  1255. FUNCTION CallOCERecipientStreamerProc(buffer: UNIV Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT; userRoutine: OCERecipientStreamerUPP): OSErr;
  1256.     {$IFC NOT GENERATINGCFM}
  1257.     INLINE $205F, $4E90;
  1258.     {$ENDC}
  1259.     
  1260. TYPE
  1261.     OCERecipientStreamer = OCERecipientStreamerUPP;
  1262.  
  1263.  
  1264. FUNCTION OCEStreamRecipient({CONST}VAR rcpt: OCERecipient; stream: OCERecipientStreamer; userData: LONGINT; VAR actualCount: LONGINT): OSErr;
  1265.     {$IFC NOT GENERATINGCFM}
  1266.     INLINE $303C, 833, $AA5C;
  1267.     {$ENDC}
  1268. { Get the OCERecipient's extensionType. Safe to pass dereferenced handle(s).}
  1269. FUNCTION OCEGetRecipientType({CONST}VAR cid: CreationID): OSType;
  1270.     {$IFC NOT GENERATINGCFM}
  1271.     INLINE $303C, 834, $AA5C;
  1272.     {$ENDC}
  1273. {
  1274. Set the OCERecipient's extensionType in the specified cid.  (Note: we do NOT
  1275. check for a nil pointer).  If the extensionType is 'entn', the cid is assumed
  1276. to be "valid" and is not touched.  Note: to properly handle non 'entn''s this
  1277. routine must and will zero the high long (source) of the cid! Safe to pass
  1278. dereferenced handle(s).
  1279. }
  1280. PROCEDURE OCESetRecipientType(extensionType: OSType; VAR cid: CreationID);
  1281.     {$IFC NOT GENERATINGCFM}
  1282.     INLINE $303C, 835, $AA5C;
  1283.     {$ENDC}
  1284. {***************************************************************************************
  1285.    PLEASE NOTE! ROUTINES HAVE MOVED TO THIS HEADER!
  1286.  
  1287.    OCEGetAccessControlDSSpec and its corresponding data type and constants have
  1288.    moved to the OCE header from OCEAuthDir. The OCEAuthDir header includes the OCE
  1289.    header, so no changes to your code are required.
  1290.    
  1291. ***************************************************************************************}
  1292. { access categories bit numbers }
  1293.  
  1294. CONST
  1295.     kThisRecordOwnerBit            = 0;
  1296.     kFriendsBit                    = 1;
  1297.     kAuthenticatedInDNodeBit    = 2;
  1298.     kAuthenticatedInDirectoryBit = 3;
  1299.     kGuestBit                    = 4;
  1300.     kMeBit                        = 5;
  1301.  
  1302. { Values of CategoryMask }
  1303.     kThisRecordOwnerMask        = 0+(1 * (2**(kThisRecordOwnerBit)));
  1304.     kFriendsMask                = 0+(1 * (2**(kFriendsBit)));
  1305.     kAuthenticatedInDNodeMask    = 0+(1 * (2**(kAuthenticatedInDNodeBit)));
  1306.     kAuthenticatedInDirectoryMask = 0+(1 * (2**(kAuthenticatedInDirectoryBit)));
  1307.     kGuestMask                    = 0+(1 * (2**(kGuestBit)));
  1308.     kMeMask                        = 0+(1 * (2**(kMeBit)));
  1309.  
  1310.     
  1311. TYPE
  1312.     CategoryMask = LONGINT;
  1313.  
  1314. {
  1315. pass kThisRecordOwnerMask, kFriendsMask, kAuthenticatedInDNodeMask, kAuthenticatedInDirectoryMask,
  1316. kGuestMask, or kMeMask to this routine, and it will return a pointer to a
  1317. DSSpec that can be used in the Get or Set Access Controls calls.
  1318. }
  1319.  
  1320. FUNCTION OCEGetAccessControlDSSpec(categoryBitMask: CategoryMask): DSSpecPtr;
  1321.     {$IFC NOT GENERATINGCFM}
  1322.     INLINE $303C, 837, $AA5C;
  1323.     {$ENDC}
  1324.  
  1325. {$ALIGN RESET}
  1326. {$POP}
  1327.  
  1328. {$SETC UsingIncludes := OCEIncludes}
  1329.  
  1330. {$ENDC} {__OCE__}
  1331.  
  1332. {$IFC NOT UsingIncludes}
  1333.  END.
  1334. {$ENDC}
  1335.